package servletTest;

import java.io.IOException;
import java.net.URLDecoder;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zhongsou.np.zhuw.util.OperatorUtil;

public class SupplyServlet extends HttpServlet{
	private static final long serialVersionUID = -2220875402324915689L;
	protected void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
		OperatorUtil.enhanceResponse(response);
		String enc = request.getParameter("enc");
		enc = "utf".equalsIgnoreCase(enc) ? "utf-8" : "gb2312";
		request.setCharacterEncoding(enc);
		//得到keyword
		String keyword = request.getParameter("kw");
		System.out.println(keyword);
		keyword = URLDecoder.decode(keyword,"UTF-8");
		System.out.println(keyword);
		keyword = URLDecoder.decode(keyword,"UTF-8");
		System.out.println(keyword);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request,response);
	}
}
